package com.example;

import com.example.filter.LoginFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class DalianzhonggongApplication {

	public static void main(String[] args) {
		SpringApplication.run(DalianzhonggongApplication.class, args);
	}

	@Bean
	public FilterRegistrationBean<LoginFilter> loggingFilter(){
		FilterRegistrationBean<LoginFilter> registrationBean
			= new FilterRegistrationBean<>();

		registrationBean.setFilter(new LoginFilter());
		registrationBean.addUrlPatterns("/*");
		registrationBean.setOrder(1);

		return registrationBean;
	}
}
